import decimal


class stringUtils:

    @staticmethod
    def get_one(thing_list: list):
        thing: str = ''
        count = 0
        for e in thing_list:
            count += 1
            if count != len(thing_list):
                thing += e + "||"
            else:
                thing += e
        return thing

    @staticmethod
    def get_list(thing: str):
        return thing.split("||")

    @staticmethod
    def get_last_num_chars(s, num):
        if len(s) >= num:
            return s[-num:]
        else:
            return s

    @staticmethod
    def get_export_str(thing_list: list):
        thing: str = ''
        count = 0
        for e in thing_list:
            count += 1
            if count != len(thing_list):
                thing += e + "--"
            else:
                thing += e
        return thing

    @staticmethod
    def expense_export_str(qibu: decimal, guding: decimal, licheng: decimal, tingyan: decimal):
        # print("Hello, {name}. You are {age} years old.".format(name=name, age=age))
        sum = qibu + guding + licheng + tingyan
        return "起步价{qibu}元+固定{guding}元 +里程{licheng}元+停延费{tingyan}元= {sum}元".format(qibu=qibu, guding=guding,
                                                                                           licheng=licheng,
                                                                                           tingyan=tingyan,
                                                                                           sum=sum)
